package org.zsl.dao;

import org.zsl.model.User;

import java.sql.ResultSet;
import java.util.List;

public class UserDAO2 implements IUserDAO {
    @Override
    public Boolean insert(User user) {

        String sql = "insert into user(username,password,role_id) value(?,?,?)";

        Object[] params = new Object[3];
        params[0] = user.getUsername();
        params[1]=user.getPassword();
        params[2]=user.getRoleId();

        return DBUtil.excuteUpate(sql,params)>0;
    }

    @Override
    public List<User> selectAll() {

        String sql = "select * from user";
        ResultSet resultSet = DBUtil.excuteQuery(sql, null);

        return convertToList(resultSet);

    }

    private List<User> convertToList(ResultSet resultSet){
        return  null;
    }

    @Override
    public Boolean update(User user) {
        return null;
    }

    @Override
    public Boolean delete(Integer userId) {
        return null;
    }
}
